require "migration_helpers"
class CreateMetas < ActiveRecord::Migration
  extend MigrationHelpers
  def self.up
    create_table :metas do |t|
      t.column :title, :string
      t.column :abstract, :text
      t.column :type_id, :integer
      t.column :edition, :string
      t.column :price, :string
      t.column :coverage_spatial, :string
      t.column :coverage_temporal, :string
      t.column :finish_at, :timestamp
      t.column :validate_at, :timestamp
      t.column :parent_id, :integer
      t.column :user_id, :integer
    end
    foreign_key(:metas, :parent_id, :metas)
    foreign_key(:metas, :type_id, :types)
    foreign_key(:metas, :user_id, :metas)
  end

  def self.down
    drop_table :metas
  end
end
